home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / math / eval30.zip / EVAL.DOC < prev    next >
Text File  |  1994-07-02  |  8KB  |  216 lines

  1.                               EVAL 3.0 - 7/2/94
  2.                         The DOS Expression evaluator
  3.                              By: Terry A. Reagan
  4. WHAT IS EVAL?
  5.     EVAL is a DOS expression evaluator. EVAL could be thought of as a
  6.     command line calculator.  It allows you to get immediate answer to
  7.     calculations directly from the command line.
  8.  
  9.     For example, to calculate the area of a circle 2.4 feet in diameter, you
  10.     could type:
  11.         EVAL pi*2.4^2
  12.     and would get the answer as 18.0955736846772091 square feet.
  13.  
  14.     Syntax is:        EVAL  expression[,format]
  15.  
  16. AVAILABLE OPERATORS
  17.     Arithmetic operators:
  18.             + Addition              - Subtraction
  19.             * Multiplication        / Division
  20.             ^ Exponentiation        % Remainder (MOD)
  21.     Bitwise operators:
  22.             & Logical AND           | Logical OR
  23.             @ Logical XOR
  24.     Special Operators:
  25.             ? Roll and add
  26.             () Parentheses are used to enclose other operations.
  27.     Functions:
  28.             SIN,COS,TAN              Trig functions
  29.             ASIN, ACOS, ATAN         Inverse SIN,COS,TAN
  30.             EXP,LN                   e^x, Log base e
  31.             LOG                      Log base 10
  32.             SQRT                     Square root of x
  33.             ABS                      Absolute value
  34.             ERF                      Error function
  35.  
  36.     Constants:
  37.             e  = 2.718281828459045235
  38.             pi = 3.141592653589793238
  39.  
  40.     Formats:
  41.             Formats determine how the number is displayed.
  42.                 x  = Hex
  43.                 b  = Binary
  44.                 10 = Decimal
  45.                 8  = Octal
  46.                 p  = Programmer format. The number is displayed in
  47.                      decimal, and is followed by a hex representation
  48.                      of the 10 byte internal format.
  49.                 p4 = Programmer format displaying 4 byte floats.
  50.                 p8 = Programmer format displaying 8 byte floats.
  51.  
  52.             For other base between 2 and 36, the value
  53.             can be used.  For example, to show 1 million
  54.             in base 36, type:
  55.                 EVAL 1000000,36
  56.  
  57.     Number prefixes:
  58.             0x specifies a hex number.
  59.             0b specifies a binary number.
  60.  
  61. GENERAL COMMENTS AND NOTES ABOUT USING EVAL
  62.   - All trig functions work in radians, not degrees.
  63.  
  64.   - The | symbol is not valid on a DOS command line
  65.     unless inside quotes, so if you want to use the
  66.     bitwise "OR" function, type
  67.             EVAL "22|55" instead of EVAL 22|55
  68.     Otherwise, DOS thinks you are calling EVAL 22
  69.     and piping the result to a program called 55.
  70.     To show this result in hex, type
  71.         EVAL "22|55",x
  72.  
  73.   - "Roll and add" is a function used for certain games. Ever wanted
  74.     to roll a 9 sided die? Now you can. Type
  75.        EVAL 1?9
  76.     If you wish to roll three normal (6 sided) dice and add the result, type
  77.        EVAL 3?6
  78.     This will "roll" three six-sided dice and add the results.
  79.  
  80.   - All numbers are stored as 80 bit floating point numbers. (C long doubles).
  81.     In all cases, I try to maintain precision.
  82.  
  83.   - EVAL follows normal algebraic rules for precedence.  That is, operations
  84.     inside () happen first.  If there are no (), exponentiation occurs before
  85.     multiplication and division.  Multiplication and division occur before
  86.     addition and subtraction.
  87.  
  88.   - EVAL was written and compiled using Microsoft Visual C++ V1.0.
  89.  
  90. SPECIAL NOTES TO PROGRAMMERS
  91.     One of the most valuable features of EVAL is the ability to handle very
  92.     large numbers in hex, decimal and binary. Most of the commercial
  93.     calculators I have seen can only handle 4 byte hex numbers. On several
  94.     occasions, I found this to be inadequate.  EVAL stores ALL numbers as
  95.     10 byte floating point numbers, so you can do hex calculations with
  96.     larger numbers and with higher precision. You can also display the
  97.     fractional portion of non-integers in hex, or display the internal
  98.     representation of floating point numbers.
  99.  
  100.  
  101. EXAMPLES
  102.     Calculate the sum of 2,3,5,7 and 11.
  103.          EVAL 2+3+5+7+11
  104.     Find 2 to the power of (3+7).
  105.          EVAL 2^(3+7)
  106.     Find the sum of 12 eight-sided dice rolled randomly
  107.     and add 2 to the result.
  108.     (For RPG players, this is 12d8+2)
  109.          EVAL 12?8+2
  110.     Find the TAN of 30 degrees.
  111.          EVAL TAN(30*PI/180)
  112.     Convert the number 123,456 to hex.
  113.          EVAL 123456,x
  114.     Convert the number 500 to binary.
  115.          EVAL 500,b
  116.     Convert the number 10000 to base 4.
  117.          EVAL 10000,4
  118.     Convert the hex number 01AB to decimal.
  119.          EVAL 0x1AB
  120.     (Note: decimal is the default format.)
  121.     Convert the hex number 12 to binary
  122.          EVAL 0x12,b
  123.     Add the hex number 100 to the decimal number 100
  124.          EVAL 0x100+100
  125.     Show PI in hex
  126.          EVAL PI,x
  127.  
  128. PROGRAMMER EXAMPLES
  129.     What is 123,456,789,012,345,678 in hex?
  130.         EVAL 123456789012345678,x
  131.  
  132.     What is the decimal value of the hex number 1AABBCCDDEEFF?
  133.         EVAL 0x1AABBCCDDEEFF
  134.  
  135.     What is the internal represation of pi as a 10 byte floating point number?
  136.     As an 8 byte floating point number?
  137.     As a 4 byte floating point number?
  138.         EVAL pi,p
  139.         EVAL pi,p8
  140.         EVAL pi,p4
  141.  
  142. HISTORY
  143.     Eval was written by Terry A. Reagan.
  144.  
  145.     EVAL has been an ongoing project since 1985. I have added features as
  146.     needed.
  147.  
  148.     8/09/85 Version 1.0 handles simple operators +,-,*,/, and ().
  149.  
  150.     2/18/86 Added functions including TRIG, LOG, and ERF functions.
  151.             Version 1.1
  152.  
  153.     4/14/91 Added roll function.
  154.             Version 1.2
  155.  
  156.     6/29/91 Added bitwise operators.
  157.             Added option to print results in hex
  158.             Added option to input number in hex and binary.
  159.             Added option to print in bases other than hex.
  160.             Version 2.0
  161.  
  162.     6/05/93 Pulled out high-speed table driven parser and replaced with
  163.             much smaller and slower C parser.
  164.             Convert the entire program to C++.
  165.             Version 2.1
  166.  
  167.     7/02/94 Code clean up and documentation in preparation for Shareware
  168.             release.
  169.             Programmer formats added to displaying the actual bytes which
  170.             make up the number as stored.
  171.             Version 3.0 is initial shareware release
  172.  
  173.  
  174. POSSIBLE FUTURE ENHANCEMENTS
  175.     - Add hyperbolic functions. (SINH, COSH, TANH,...)
  176.     - Allow entering numbers of any base.
  177.     - Better error handling when a library function fails.
  178.     - Make a better/smarter/faster version of the roll function using ERF.
  179.  
  180. PAYMENT OF SHAREWARE FEES
  181.     There are no required fees.  If you find EVAL to be useful, or if your
  182.     conscience is getting the better of you and you feel compelled to pay
  183.     something, do one or more of the following:
  184.         1) Send me a copy of your favorite SHAREWARE or FREEWARE utility
  185.             or game. (Please don't send me pirated software.)
  186.         2) Send me a note telling how you are using EVAL and what I can do
  187.             to improve it for your particular use.
  188.         3) Donate money to the American Heart Association, National Cancer
  189.             Society, Aids Foundation, Diabetic Society, or some other equally
  190.             worthy cause.
  191.  
  192. DISTRIBUTION AND COPYRIGHTS
  193.     The program EVAL is copyrighted 1985-1994 by Terry A. Reagan.
  194.     You may copy, distribute and use this program free of charge, but:
  195.  
  196.         You must not charge for copying or distributions, other
  197.         than a nominal charge for media, materials and postage.
  198.  
  199.         If you distribute EVAL, you must distribute the entire
  200.         package without modification. This includes:
  201.             EVAL.EXE, EVAL.DOC, DEMO.BAT
  202.  
  203.  
  204. CONTACTING THE AUTHOR
  205.     The program EVAL was written by Terry A. Reagan.
  206.     If you are using EVAL and have found it to be useful, I would love to
  207.     hear from you. If you have any ideas of suggestions, please let me know.
  208.     I can be reached at
  209.  
  210.                     CompuServe: 76520,464
  211.                     Internet:   76520.464@compuserve.com
  212.                     Prodigy:    GWSF28A
  213.  
  214.     I hope you find this program useful.
  215.             Terry (-t)
  216.